package com.api.department.createdepartment;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IDepartmentApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(locations = "classpath:/department/department-toedit.xml")
public class CreateDepartmentNotDepartmentCreator extends AbstractApiTest {

	@Value("#{org_toedit[notDepartmentCreator].appId}")
	private String userUrn;

	@Value("#{org_toedit[notDepartmentCreator].password}")
	private String userPassword;

	@BeforeClass
	protected void loginUser() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test(expectedExceptions = ZyncroApiException.class)
	public void test() throws ZyncroApiException {

		String name = "A name";
		String description = null;
		String address = null;
		String telephone = null;
		String email = null;
		String web = null;
		String fax = null;
		boolean showMembers = false;
		String idUserOwner = null;
		String attributes = null;
		boolean followerComment = false;

		getApi().getService(IDepartmentApiService.class).createDepartment(name, description, address, telephone, email, web, fax,
				showMembers, idUserOwner, attributes, followerComment);
	}
}
